﻿<!--
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
-->

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls"
    xmlns:primitives="clr-namespace:Microsoft.Phone.Controls.Primitives">

    <Style TargetType="primitives:ToggleSwitchButton">
        <Setter Property="Background" Value="{StaticResource PhoneBackgroundBrush}"/>
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="SwitchForeground" Value="{StaticResource PhoneAccentBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="primitives:ToggleSwitchButton">
                    <Border
                        x:Name="Root"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        CacheMode="BitmapCache"
                        Opacity="{TemplateBinding Opacity}"
                        Padding="{TemplateBinding Padding}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ColorAnimation
                                            Storyboard.TargetName="SwitchBottom"
                                            Storyboard.TargetProperty="(Grid.Background).(SolidColorBrush.Color)"
                                            Duration="0"
                                            To="{StaticResource PhoneForegroundColor}"/>
                                        <ColorAnimation
                                            Storyboard.TargetName="ThumbCenter"
                                            Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
                                            Duration="0"
                                            To="{StaticResource PhoneForegroundColor}"/>
                                        <DoubleAnimation
                                            Storyboard.TargetName="Root"
                                            Storyboard.TargetProperty="Opacity"
                                            Duration="0"
                                            To="0.3"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CheckStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.05" To="Unchecked"/>
                                    <VisualTransition GeneratedDuration="0:0:0.05" To="Checked"/>
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Checked">
                                    <Storyboard>
                                        <DoubleAnimation
                                            Storyboard.TargetName="BackgroundTranslation"
                                            Storyboard.TargetProperty="(TranslateTransform.X)"
                                            Duration="0"
                                            To="68">
                                            <DoubleAnimation.EasingFunction>
                                                <ExponentialEase Exponent="15" EasingMode="EaseOut"/>
                                            </DoubleAnimation.EasingFunction>
                                        </DoubleAnimation>
                                        <DoubleAnimation
                                            Storyboard.TargetName="ThumbTranslation"
                                            Storyboard.TargetProperty="(TranslateTransform.X)"
                                            Duration="0"
                                            To="68">
                                            <DoubleAnimation.EasingFunction>
                                                <ExponentialEase Exponent="15" EasingMode="EaseOut"/>
                                            </DoubleAnimation.EasingFunction>
                                        </DoubleAnimation>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Dragging"/>
                                <VisualState x:Name="Unchecked">
                                    <Storyboard>
                                        <DoubleAnimation
                                            Storyboard.TargetName="BackgroundTranslation"
                                            Storyboard.TargetProperty="(TranslateTransform.X)"
                                            Duration="0"
                                            To="0"/>
                                        <DoubleAnimation
                                            Storyboard.TargetName="ThumbTranslation"
                                            Storyboard.TargetProperty="(TranslateTransform.X)"
                                            Duration="0"
                                            To="0"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid x:Name="SwitchRoot" Background="Transparent" Height="95" Width="136">
                            <Grid x:Name="SwitchTrack" Width="88">
                                <Grid x:Name="SwitchBottom" Background="{TemplateBinding SwitchForeground}" Height="32">
                                    <Rectangle
                                        x:Name="SwitchBackground"
                                        Fill="{TemplateBinding Background}"
                                        Width="76"
                                        Height="20"
                                        HorizontalAlignment="Center"
                                        VerticalAlignment="Center">
                                        <Rectangle.RenderTransform>
                                            <TranslateTransform x:Name="BackgroundTranslation"/>
                                        </Rectangle.RenderTransform>
                                    </Rectangle>
                                    <Border BorderBrush="{StaticResource PhoneForegroundBrush}" BorderThickness="2">
                                        <Border BorderBrush="{StaticResource PhoneBackgroundBrush}" BorderThickness="4"/>
                                    </Border>
                                </Grid>
                                <Border
                                    x:Name="SwitchThumb"
                                    BorderBrush="{StaticResource PhoneBackgroundBrush}"
                                    BorderThickness="4,0"
                                    Margin="-4,0"
                                    Width="28"
                                    Height="36"
                                    HorizontalAlignment="Left">
                                    <Border.RenderTransform>
                                        <TranslateTransform x:Name="ThumbTranslation"/>
                                    </Border.RenderTransform>
                                    <Border
                                        x:Name="ThumbCenter"
                                        BorderBrush="{StaticResource PhoneForegroundBrush}"
                                        BorderThickness="2"
                                        Background="White"/>
                                </Border>
                            </Grid>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="controls:ToggleSwitch">
        <Setter Property="Background" Value="{StaticResource PhoneBackgroundBrush}"/>
        <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilyLight}"/>
        <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeLarge}"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="SwitchForeground" Value="{StaticResource PhoneAccentBrush}"/>
        <Setter Property="VerticalContentAlignment" Value="Top"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:ToggleSwitch">
                    <Border
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        Padding="{TemplateBinding Padding}"
                        CacheMode="BitmapCache">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation
                                            Storyboard.TargetName="Header"
                                            Storyboard.TargetProperty="Opacity"
                                            Duration="0"
                                            To="0.3"/>
                                        <DoubleAnimation
                                            Storyboard.TargetName="Content"
                                            Storyboard.TargetProperty="Opacity"
                                            Duration="0"
                                            To="0.3"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid Margin="12,5,36,42">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <ContentControl
                                x:Name="Header"
                                Content="{TemplateBinding Header}"
                                ContentTemplate="{TemplateBinding HeaderTemplate}"
                                FontFamily="{StaticResource PhoneFontFamilyNormal}"
                                FontSize="{StaticResource PhoneFontSizeNormal}"
                                Foreground="{StaticResource PhoneBorderBrush}"
                                HorizontalAlignment="Left"
                                IsTabStop="False"
                                Margin="-1,0,0,0"
                                Opacity="{TemplateBinding Opacity}"
                                VerticalAlignment="Bottom"/>
                            <ContentControl
                                x:Name="Content"
                                Grid.Row="1"
                                Content="{TemplateBinding Content}"
                                ContentTemplate="{TemplateBinding ContentTemplate}"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                IsTabStop="False"
                                Margin="-1,1,0,-7"
                                Opacity="{TemplateBinding Opacity}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                            <primitives:ToggleSwitchButton
                                x:Name="Switch"
                                Grid.RowSpan="2"
                                Grid.Column="1"
                                Background="{TemplateBinding Background}"
                                Margin="-22,-29,-24,-28"
                                Opacity="{TemplateBinding Opacity}"
                                SwitchForeground="{TemplateBinding SwitchForeground}"
                                VerticalAlignment="Bottom"/>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="controls:ContextMenu">
        <Setter Property="Background" Value="{StaticResource PhoneForegroundBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource PhoneBackgroundBrush}"/>
        <Setter Property="Padding" Value="0 14 0 16"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:ContextMenu">
                    <StackPanel RenderTransformOrigin="0.5,0">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="VisibilityStates">
                                <VisualState x:Name="Open">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Duration="0:0:0.42" Storyboard.TargetName="ScaleX" Storyboard.TargetProperty="ScaleX">
                                            <LinearDoubleKeyFrame KeyTime="0:0:0" Value="0"/>
                                            <LinearDoubleKeyFrame KeyTime="0:0:0.3" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Duration="0:0:0.42" Storyboard.TargetName="ScaleY" Storyboard.TargetProperty="ScaleY">
                                            <LinearDoubleKeyFrame KeyTime="0:0:0.3" Value="0"/>
                                            <LinearDoubleKeyFrame KeyTime="0:0:0.42" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Closed">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="ScaleX" Storyboard.TargetProperty="ScaleX" To="0"/>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="ScaleY" Storyboard.TargetProperty="ScaleY" To="0"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <StackPanel.RenderTransform>
                            <ScaleTransform x:Name="ScaleX"/>
                        </StackPanel.RenderTransform>
                        <Rectangle Height="2" Fill="{TemplateBinding BorderBrush}"/>
                        <Rectangle Height="2" Fill="{TemplateBinding Background}"/>
                        <StackPanel
                            Background="{TemplateBinding Background}"
                            RenderTransformOrigin="0.5,0">
                            <StackPanel.RenderTransform>
                                <ScaleTransform x:Name="ScaleY"/>
                            </StackPanel.RenderTransform>
                            <ItemsPresenter Margin="{TemplateBinding Padding}"/>
                            <Rectangle Height="2" Fill="{TemplateBinding BorderBrush}"/>
                        </StackPanel>
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="controls:MenuItem">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneBackgroundBrush}"/>
        <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilySemiLight}"/>
        <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeLarge}"/>
        <Setter Property="Padding" Value="25 12 25 12"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:MenuItem">
                    <Grid Background="{TemplateBinding Background}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="Presenter" Storyboard.TargetProperty="Opacity" To="0.5"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <ContentPresenter
                            x:Name="Presenter"
                            Content="{TemplateBinding Header}"
                            ContentTemplate="{TemplateBinding HeaderTemplate}"
                            Margin="{TemplateBinding Padding}"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="controls:Separator">
        <Setter Property="Background" Value="{StaticResource PhoneBackgroundBrush}"/>
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="Margin" Value="20 4 20 4"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:Separator">
                    <Border
                        BorderThickness="{TemplateBinding BorderThickness}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        Background="{TemplateBinding Background}"
                        Height="3"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="primitives:LoopingSelector">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <Border Background="Transparent">
                        <Canvas x:Name="ItemsPanel">
                            <Canvas.RenderTransform>
                                <TransformGroup>
                                    <TranslateTransform x:Name="CenteringTransform"/>
                                    <TranslateTransform x:Name="PanningTransform"/>
                                </TransformGroup>
                            </Canvas.RenderTransform>
                        </Canvas>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="controls:LongListSelector">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <Border 
                        Background="{TemplateBinding Background}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        BorderBrush="{TemplateBinding BorderBrush}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="ScrollStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="00:00:00.5"/>
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Scrolling">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="VerticalScrollBar" Storyboard.TargetProperty="Opacity" To="1" Duration="0"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="NotScrolling">
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid Margin="{TemplateBinding Padding}">
                            <Canvas x:Name="ItemsPanel">
                                <Canvas.RenderTransform>
                                    <TranslateTransform x:Name="PanningTransform"/>
                                </Canvas.RenderTransform>
                            </Canvas>
                            <ScrollBar x:Name="VerticalScrollBar" IsHitTestVisible="False" Opacity="0" Height="Auto" Width="5" HorizontalAlignment="Right" VerticalAlignment="Stretch" IsTabStop="False" Minimum="0" Orientation="Vertical" CacheMode="BitmapCache"/>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="primitives:LoopingSelectorItem">
        <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
        <Setter Property="Padding" Value="6"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <Border x:Name="root" Opacity="0" CacheMode="BitmapCache" Background="Transparent" Padding="{TemplateBinding Padding}">

                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">

                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.2"/>
                                </VisualStateGroup.Transitions>

                                <VisualState x:Name="Normal"/>

                                <VisualState x:Name="Expanded">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="root" Storyboard.TargetProperty="Opacity" To="1" Duration="0"/>
                                        <DoubleAnimation Storyboard.TargetName="background" Storyboard.TargetProperty="Opacity" To="0" Duration="0"/>
                                        <DoubleAnimation Storyboard.TargetName="contentPresenter" Storyboard.TargetProperty="Opacity" To=".6" Duration="0"/>
                                    </Storyboard>
                                </VisualState>

                                <VisualState x:Name="Selected">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="root" Storyboard.TargetProperty="Opacity" To="1" Duration="0"/>
                                        <DoubleAnimation Storyboard.TargetName="background" Storyboard.TargetProperty="Opacity" To="1" Duration="0"/>
                                    </Storyboard>
                                </VisualState>

                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <Border.RenderTransform>
                            <TranslateTransform x:Name="Transform"/>
                        </Border.RenderTransform>

                        <Grid>
                            <Rectangle x:Name="background" Margin="2" Opacity="0" Fill="{StaticResource PhoneInactiveBrush}" CacheMode="BitmapCache"/>

                            <Border BorderThickness="2" BorderBrush="{StaticResource PhoneInactiveBrush}">
                                <ContentPresenter x:Name="contentPresenter" CacheMode="BitmapCache"/>
                            </Border>
                        </Grid>

                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="controls:DatePicker">
        <Setter Property="Background" Value="{StaticResource PhoneTextBoxBrush}"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneTextBoxForegroundBrush}"/>
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="PickerPageUri" Value="/Microsoft.Phone.Controls.Toolkit;component/DateTimePickers/DatePickerPage.xaml"/>
        <Setter Property="ValueStringFormat" Value="{}{0:d}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:DatePicker">
                    <StackPanel>
                        <ContentControl
                            Content="{TemplateBinding Header}"
                            ContentTemplate="{TemplateBinding HeaderTemplate}"
                            Foreground="{StaticResource PhoneSubtleBrush}"
                            HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                            Margin="12,0,12,-4"/>
                        <Button
                            x:Name="DateTimeButton"
                            Content="{TemplateBinding ValueString}"
                            Background="{TemplateBinding Background}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            FontFamily="{TemplateBinding FontFamily}"
                            Foreground="{TemplateBinding Foreground}"
                            Height="72"
                            HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"/>
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="controls:TimePicker">
        <Setter Property="Background" Value="{StaticResource PhoneTextBoxBrush}"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneTextBoxForegroundBrush}"/>
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="PickerPageUri" Value="/Microsoft.Phone.Controls.Toolkit;component/DateTimePickers/TimePickerPage.xaml"/>
        <!-- Ideally, the short time pattern 't' would be correct. However, it does not respect
             the system's "24-hour clock" setting override and so the correct effective value of
             ValueStringFormat is determined on an as-needed basis (unless overridden). -->
        <!--<Setter Property="ValueStringFormat" Value="{}{0:t}"/>-->
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:TimePicker">
                    <StackPanel>
                        <ContentControl
                            Content="{TemplateBinding Header}"
                            ContentTemplate="{TemplateBinding HeaderTemplate}"
                            Foreground="{StaticResource PhoneSubtleBrush}"
                            HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                            Margin="12,0,12,-4"/>
                        <Button
                            x:Name="DateTimeButton"
                            Content="{TemplateBinding ValueString}"
                            Background="{TemplateBinding Background}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            FontFamily="{TemplateBinding FontFamily}"
                            Foreground="{TemplateBinding Foreground}"
                            Height="72"
                            HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"/>
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="controls:ListPicker">
        <Setter Property="Background" Value="{StaticResource PhoneTextBoxBrush}"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneTextBoxForegroundBrush}"/>
        <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMediumLarge}"/>
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="Margin" Value="{StaticResource PhoneTouchTargetOverhang}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:ListPicker">
                    <StackPanel>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="PickerStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="Expanded">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames
                                            Storyboard.TargetName="Border"
                                            Storyboard.TargetProperty="Background"
                                            Duration="0">
                                            <DiscreteObjectKeyFrame
                                                Value="{StaticResource PhoneTextBoxEditBackgroundColor}"
                                                KeyTime="0"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames
                                            Storyboard.TargetName="Border"
                                            Storyboard.TargetProperty="BorderBrush"
                                            Duration="0">
                                            <DiscreteObjectKeyFrame
                                                Value="{StaticResource PhoneTextBoxEditBorderBrush}"
                                                KeyTime="0"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <ContentControl
                            Content="{TemplateBinding Header}"
                            ContentTemplate="{TemplateBinding HeaderTemplate}"
                            Foreground="{StaticResource PhoneSubtleBrush}"
                            FontSize="{StaticResource PhoneFontSizeNormal}"
                            HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                            Margin="0 0 0 8"/>
                        <Grid>
                            <Border
                                x:Name="Border"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding Background}"
                                BorderThickness="2">
                                <Canvas x:Name="ItemsPresenterHost" MinHeight="46">
                                    <ItemsPresenter x:Name="ItemsPresenter">
                                        <ItemsPresenter.RenderTransform>
                                            <TranslateTransform x:Name="ItemsPresenterTranslateTransform"/>
                                        </ItemsPresenter.RenderTransform>
                                    </ItemsPresenter>
                                </Canvas>
                            </Border>
                            <Popup x:Name="FullModePopup">
                                <Border Background="{StaticResource PhoneChromeBrush}"> <!-- Popup.Child should always be a Border -->
                                    <Grid>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto"/>
                                            <RowDefinition/>
                                        </Grid.RowDefinitions>
                                        <ContentControl
                                            Grid.Row="0"
                                            Content="{TemplateBinding FullModeHeader}"
                                            Foreground="{StaticResource PhoneForegroundBrush}"
                                            FontFamily="{StaticResource PhoneFontFamilySemiBold}"
                                            FontSize="{StaticResource PhoneFontSizeMedium}"
                                            HorizontalAlignment="Left"
                                            Margin="24 12 0 0"/>
                                        <ListBox
                                            x:Name="FullModeSelector"
                                            Grid.Row="1"
                                            ItemTemplate="{TemplateBinding ActualFullModeItemTemplate}"
                                            FontSize="{TemplateBinding FontSize}"
                                            Margin="{StaticResource PhoneMargin}">
                                            <ListBox.ItemsPanel>
                                                <ItemsPanelTemplate>
                                                    <StackPanel/> <!-- Ensures all containers will be available during the Loaded event -->
                                                </ItemsPanelTemplate>
                                            </ListBox.ItemsPanel>
                                        </ListBox>
                                    </Grid>
                                </Border>
                            </Popup>
                        </Grid>
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="controls:ListPickerItem">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="Padding" Value="8 6"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:ListPickerItem">
                    <Grid Background="{TemplateBinding Background}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="SelectionStates">
                                <VisualState x:Name="Unselected"/>
                                <VisualState x:Name="Selected">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames
                                            Storyboard.TargetName="ContentContainer"
                                            Storyboard.TargetProperty="Foreground"
                                            Duration="0">
                                            <DiscreteObjectKeyFrame
                                                Value="{StaticResource PhoneAccentBrush}"
                                                KeyTime="0"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <ContentControl
                            x:Name="ContentContainer"
                            Content="{TemplateBinding Content}"
                            ContentTemplate="{TemplateBinding ContentTemplate}"
                            Foreground="{TemplateBinding Foreground}"
                            VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                            HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                            Margin="{TemplateBinding Padding}"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="controls:AutoCompleteBox">
        <Setter Property="Background" Value="{StaticResource PhoneTextBoxBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource PhoneTextBoxBrush}"/>
        <Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}"/>
        <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilyNormal}"/>
        <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMediumLarge}"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneTextBoxForegroundBrush}"/>
        <Setter Property="ItemTemplate">
            <Setter.Value>
                <DataTemplate>
                    <ContentControl Content="{Binding}" Margin="8,7"/>
                </DataTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Padding" Value="6,0,6,4"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:AutoCompleteBox">
                    <Grid>
                        <TextBox
                            x:Name="Text"
                            Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            FontFamily="{TemplateBinding FontFamily}"
                            FontSize="{TemplateBinding FontSize}"
                            FontStyle="{TemplateBinding FontStyle}"
                            FontWeight="{TemplateBinding FontWeight}"
                            Foreground="{TemplateBinding Foreground}"
                            InputScope="{TemplateBinding InputScope}"
                            Opacity="{TemplateBinding Opacity}"
                            Padding="{TemplateBinding Padding}"
                            Style="{TemplateBinding TextBoxStyle}"/>
                        <Popup x:Name="Popup">
                            <ListBox
                                x:Name="Selector"
                                Background="White"
                                BorderBrush="{StaticResource PhoneTextBoxEditBorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                FontFamily="{TemplateBinding FontFamily}"
                                FontSize="{TemplateBinding FontSize}"
                                FontStyle="{TemplateBinding FontStyle}"
                                FontWeight="{TemplateBinding FontWeight}"
                                Foreground="{TemplateBinding Foreground}"
                                IsTabStop="False"
                                ItemContainerStyle="{TemplateBinding ItemContainerStyle}"
                                ItemTemplate="{TemplateBinding ItemTemplate}"
                                Opacity="{TemplateBinding Opacity}"
                                Padding="0,8"/>
                        </Popup>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="controls:TransitionFrame">
        <Setter Property="Background" Value="{StaticResource PhoneBackgroundBrush}"/>
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:TransitionFrame">
                    <Border
                        x:Name="ClientArea"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        Margin="{TemplateBinding Margin}">
                        <Grid>
                            <ContentPresenter
                                x:Name="FirstContentPresenter"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                            <ContentPresenter
                                x:Name="SecondContentPresenter"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>